# -*- coding: utf-8 -*-
# @File     : permissions.py
# @Author   : bingjia
# @Time     : 2020/8/11 10:32
# @Desc     :

from operation.base.api import permissions
from operation.base.api.permissions import IsSuperUser
from operation.base.api.permissions import BasePermission
from operation.base.api.permissions import IsAuthenticated

from operation.permissions.permissions import HasProjectPerm
from operation.permissions.permissions import IsProjectAdmin
from operation.permissions.permissions import IsProjectMembership


class DataPermission(BasePermission):
    """
    数据权限
    """
    # 全局权限
    global_perms = None
    # enough_perms = IsSuperUser()

    # 增删改查
    list_perms = IsAuthenticated() & HasProjectPerm("view_data")
    upload_chunk_perms = IsAuthenticated()
    check_chunk_perms = IsAuthenticated()
    merge_chunk_perms = IsAuthenticated()


class SrcDataAdminPermission(BasePermission):
    """
    数据管理权限
    """
    enough_perms = IsSuperUser()

    list_perms = IsSuperUser()


class MarkDataAdminPermission(BasePermission):
    """
    数据管理权限
    """
    enough_perms = IsSuperUser()

    list_perms = IsSuperUser()